import QtQuick 1.0
import "G.js" as G

Item {
    id: idImagesDelegate
    height: 63
    width: 60

    signal imageSelected(string url)

    Image {
        id: idPlaceholder
        anchors.fill: parent
        anchors.margins: 2
        source: "art/imgPlaceHolder.png"
        Behavior on opacity { NumberAnimation { duration: 100 } }
    }

    Image {
        id: idImage
        anchors.fill: parent
        anchors.margins: 2
        source: imageThumb
        opacity: 0.0
        onProgressChanged: {
            if (progress == 1.0) {
                idPlaceholder.opacity = 0.0
                idImage.opacity = 1.0
            }
        }
        Behavior on opacity { NumberAnimation { duration: 100 } }
    }

    MouseArea {
        anchors.fill: parent
        onClicked: idImagesDelegate.imageSelected(imageThumb)
    }

}
